import React, { Component } from 'react'
//import qs from 'querystring'
const detailData=[
    {id:'01',content:'数据1'},
    {id:'02',content:'数据2'},
    {id:'03',content:'数据3'},

]
export default class Detail extends Component {
    render() {
        console.log(this.props)
        //params接收参数
        //const {id,title}=this.props.match.params
        //search接收参数
        //const {search}=this.props.location
        //const {id,title}=qs.parse(search.slice(1))
        // state 接收参数
        const {id,title}=this.props.location.state
        const findRes =detailData.find((detailObj)=>{
            return detailObj.id ===id
        })
        return (
           <ul>
               <li>Id:{id}</li>
               <li>Title:{title}</li>
               <li>content:{findRes.content}</li>

           </ul>
        )
    }
}
